package mware_lib;
import java.io.Serializable;
import java.util.Objects;

public class ObjectRef implements Serializable{
  public String hostName;
  public int port;
  public int listIndex;

  public ObjectRef(String hostName, int port, int listIndex) {
    this.hostName = hostName;
    this.port = port;
    this.listIndex = listIndex;
  }

  @Override
  public int hashCode() {
    int hash = 7;
    hash = 83 * hash + Objects.hashCode(this.hostName);
    hash = 83 * hash + this.port;
    hash = 83 * hash + this.listIndex;
    return hash;
  }

  @Override
  public boolean equals(Object obj) {
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    final ObjectRef other = (ObjectRef) obj;
    if (!Objects.equals(this.hostName, other.hostName)) {
      return false;
    }
    if (this.port != other.port) {
      return false;
    }
    if (this.listIndex != other.listIndex) {
      return false;
    }
    return true;
  }

  @Override
  public String toString() {
    return "ObjectRef{" + "hostName=" + hostName + ", port=" + port + ", listIndex=" + listIndex + '}';
  }
  
  public String stringRep()
  {
      return hostName + ":" + port + ":" + listIndex;
  }
  
  
}
